package vip.youngboy.freejump.service.user;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import vip.youngboy.freejump.domain.user.User;

import java.util.Optional;

@Service
public class UserService {


    public Optional<User> getCurrentUser() {
        String userName = SecurityContextHolder.getContext().getAuthentication().getName();
        return null;
    }

    public User getCurrentUserWithException() {
        return getCurrentUser().orElseThrow(() -> new RuntimeException("未授权用户"));
    }

}
